<?php require_once('../../core/import.php');?>
<?php User::Permission('ACCOUNT_LIST_EMAIL'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <script type="text/javascript" src="../../scripts/import.js"></script>
    <script type="text/javascript" src="../../scripts/components/checkbox/import.checkbox.js"></script>
    <script type="text/javascript" src="../../scripts/components/zebra_table/import.zebra_table.js"></script>
    <script type="text/javascript" src="scripts/list.email.js"></script>
</head>

<body>
<?php  
	 $Keyword = Functions::HttpArgs('Keyword');
	 $Keyword_first =  Functions::HttpArgs('Keyword_first');
?>
  <form id="Form_select" name="Form_select" method="post" action="list.email.php">
    <table width="98.5%" border="0" cellpadding="0" cellspacing="0" class="List">
    <thead>
    <tr>
        <th width="20%" height="25" align="right" valign="middle">公司名称(或用户名)：&nbsp; </th>
        <th width="20%" height="25" align="left" valign="middle"><input name="Keyword" type="text" size="40" /></th>
        <th width="40%" height="25" align="right" valign="middle"><input name="Keyword_first" type="hidden" value="<?php echo $Keyword?>" /><input type="button" onclick="location.href('list.email.php');" value="返 回" /></th>
        <th width="20%" height="25" align="center" valign="middle"><input type="submit" value="搜 索" /></th>
    </tr>
    </thead>
    </table>
</form>
    <table width="98.5%" id="List" border="0" cellpadding="0" cellspacing="0" class="List">
    <thead>
    <tr>
        <th width="5%" height="25" align="center" valign="middle">选取</th>
        <th width="45%" align="left" valign="middle">&nbsp;用户名</th>
        <th width="20%" align="center" valign="middle">公司名称</th>
        <th width="15%" align="center" valign="middle">注册时间</th>
        <th width="15%" align="center" valign="middle">操作</th>
    </tr>
    </thead>    
    <tbody>
    <form id="Form1" name="Form1" method="post" action="list.action.batch_delete.php">
    <?php
        #获取数据
	 
	  $Where_This=' Username not in (select Account from `account_email_verification` where Account is not null) and Username not in (select Account from `account_delete` where Account is not null)';
	  if($Keyword)
	  {
		  $Where_This=$Where_This." and (CompanyName like '%$Keyword%' or Username like '%$Keyword%')";
	  }
	  if($Keyword_first)
	  {
		  $Where_This=$Where_This." and (CompanyName like '%$Keyword_first%' or Username like '%$Keyword_first%')";
	  }
	  $Data=DB::GetData('select ID,Username,CompanyName,Datetime,Login_Datetime,M_IsTop  from `account` where '.$Where_This.' order by Datetime desc limit ?,15');
        foreach($Data['Record'] as $Row)
        {
    ?>
    <tr>
        <td height="25" align="center" valign="middle">
            <input id="ID" name="ID[]" type="checkbox" value="<?php echo $Row['ID']; ?>" class="Cursor_Pointer" />
        </td>
        <td height="25" valign="middle">
         <?php 
	  	$Title_Len=60;
		$data_email=DB::GetRows('select Account from `account_email_verification` where Account=\''.$Row['Username'].'\'');
		$data_locked=DB::GetRows('select Account from `account_locked` where Account=\''.$Row['Username'].'\'');
		$data_vip=DB::GetRows('select Account from `account_vip` where Account=\''.$Row['Username'].'\'');
		$data_integrity=DB::GetRows('select Account from `account_integrity` where Account=\''.$Row['Username'].'\'');
		if($Row['M_IsTop'])
		{
			echo '<font color="red">【置顶】</font>';
			$Title_Len=$Title_Len-4;
		}
		if(count($data_email)>0)
		{
			echo '<font color="orange">【验证】</font>';
			$Title_Len=$Title_Len-4;
		}
		if(count($data_vip)>0)
		{
			echo '<font color="Olive">【vip】</font>';
			$Title_Len=$Title_Len-4;
		}
		if(count($data_integrity)>0)
		{
			echo '<font color="Maroon">【诚信】</font>';
			$Title_Len=$Title_Len-4;
		}
		if(count($data_locked)>0)
		{
			echo '<font color="MidnightBlue">【锁定】</font>';
			$Title_Len=$Title_Len-4;
		}
	   ?>
            &nbsp;<a href="select.php?id=<?php echo $Row['ID']; ?>"><?php echo Functions::SubStr($Row['Username'],$Title_Len); ?></a>
        </td>
         <td height="25" align="center" valign="middle">
            &nbsp;<?php echo $Row['CompanyName']; ?>
        </td>
        <td height="25" align="center" valign="middle" title="<?php echo '最后登录时间为：'.$Row['Login_Datetime'];?>">
            <?php echo $Row['Datetime']?>
        </td>
        <td height="25" align="center" valign="middle">
            <a href="list.email.open.php?id=<?php echo $Row['ID']; ?>">开通</a>
            <a href="select.php?id=<?php echo $Row['ID']; ?>">查看</a>
            <a href="javascript:mconfirm_delete('list.action.delete.php?id=<?php echo $Row['ID']?>');">删除</a>
        </td>
    </tr>
    <?php
        }
    ?>
    </form>
    </tbody>    
    <tfoot>
    <tr>
        <td height="25" colspan="5" align="center" valign="middle">
            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="55%" align="left">
                <?php
                    PagerFactory::Create('Simple')->Display($Data,array
			  (
			  	'Parameters'=>array(
					'Keyword'=>$Keyword
					)
			  ));
                ?>
                </td>
                <td width="45%" align="right">
                    <span id="SelectAll" class="Cursor_Pointer">全选</span>/<span id="UnSelectAll" class="Cursor_Pointer">全不选</span>
                    选中项：
                    <span id="Delete" class="Cursor_Pointer">删除</span>&nbsp;
                    <span id="Email" class="Cursor_Pointer">开通</span>         
                </td>
            </tr>
            </table>    
         </td>
	</tr>
    </tfoot>    
    </table>
</body>
</html>